package com.ybkj.o2o.sales.common;


import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author Shine.
 *
 */
public class DateTimeHmSerialize extends JsonSerializer<Date> {

  @Override
  public void serialize(Date date, JsonGenerator gen, SerializerProvider provider)
      throws IOException, JsonProcessingException {

    DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");

    gen.writeString(format.format(date));

  }

}
